[feat] Add Google Maps links and fix event end times and time zone - #154
Merged
Conversation
Every event block now carries an "Open in Google Maps" link under its address, on both the home page and the past events page. Events also stay on the home page until they're actually over rather than disappearing the moment they start. Meetups run about three hours, so Event::DURATION captures that and the upcoming/past scopes pivot on the end time. Calendar was already hard-coding the same three hours for the ICS dtend; it now shares Event#end_at so the feed and the site can't drift apart.
The admin dashboard listed every event three to five hours ahead of when it actually starts — an 8pm meetup showed as midnight or 1am the next day. The app never set config.time_zone, so it defaulted to UTC and any bare strftime rendered UTC. Setting the zone once fixes it at the root and lets three scattered workarounds go: Event#start_time, the admin form's start_at value, and the controller's TZ_STRING round-trip on create/update. Storage is unchanged — ActiveRecord still persists UTC.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three things about how events show up on the site.
Locations are now clickable. Every event block — home page and past events — carries an "Open in Google Maps" link under the address. The address itself stays plain text:
locationis ActionText, so it can contain its own links, and wrapping it in an anchor would nest<a>tags.Events stay up until they're over. An event used to vanish from the home page the moment it started, so anyone checking the site on their way to a meetup found nothing.
upcoming/pastnow pivot on the end time.Times render in Toronto time. The admin dashboard listed every event 3–5 hours ahead of when it actually starts — an 8pm meetup showed as midnight or 1am the next day.
Building the Maps query
Locations are written as a venue name, then a street address, then arrival instructions:
Handing all of that to Maps degrades the search — the FinanceIt entry ends with two full sentences about elevator banks and a 7pm door policy.
Event#map_querykeeps the first two lines and appendscitywhen the address doesn't already name it. Against the real seed data:Workplace One, 51 Wolseley St, Toronto ONLoop Financial, 500-410 Adelaide Street West, Toronto, ON M5V 1S8FinanceIt @ The Well, 8 Spadina Ave, Toronto, CanadaThe trade-off worth knowing: if a future location puts the street on line 3 or later, the link points at the venue name alone. Maps usually still resolves it, but it's a heuristic, not a guarantee.
Event duration
There's no end-time column, and this doesn't add one —
Event::DURATION = 3.hoursencodes what the meetups actually run.Calendarwas already hard-coding the same three hours for the ICSdtend; it now sharesEvent#end_at, so the calendar feed and the site can't drift apart.Time zone
config.time_zonewas never set, so it defaulted to UTC and any barestrftimerendered UTC. Setting it once fixes the class of bug rather than the one instance, and lets three scattered workarounds go:Event#start_time, the admin form'sstart_atvalue, and the controller'sTZ_STRINGround-trip on create/update.Two things to know about the blast radius:
active_record.default_timezonestill defaults to:utc, so this is a display change only — no migration, no data touched.Validation
Full suite green — 29 runs, 94 assertions, 0 failures.
New coverage, each verified to fail without its fix:
November 25, 2024 at 7:30 PMfor a2024-11-26 00:30 UTCevent. Before the config change the same test rendersNovember 26, 2024 at 12:30 AM— confirmed by revertingconfig/application.rband re-running.The existing admin create test already pinned the form round-trip (
2024-11-25T19:30submitted →19:30-05:00stored), which is what makes droppingTZ_STRINGsafe.